package Terminal.Controller;

import java.util.*;

//import Server.Controller.CSessionObserver;

public class CSessionSubject {

		protected List<CSessionObserver> observers = new ArrayList<CSessionObserver>();

		public List<CSessionObserver> getObservers() {
			return observers;
		}

		public void setObservers(List<CSessionObserver> observers) {
			this.observers = observers;
		}
	
		public void attach(CSessionObserver observer)
		{
			observers.add(observer);
		}
		
		public void detach(CSessionObserver observer)
		{
			try 
			{
				observers.remove(observer);
			} 
			catch (Exception e) 
			{ ; }
		}
		
		public void changeNotify()
		{
			List<CSessionObserver> listatemp= observers.subList(0,observers.size());
			for(CSessionObserver obs : listatemp)
			{
				obs.update();
			}
		}
		
}
